home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The X-Philes (2nd Revision)
/
The X-Philes Number 1 (1995).iso
/
xphiles
/
hp48_1
/
city.dis
< prev
next >
Wrap
Text File
|
1995-03-23
|
2KB
|
92 lines
Article 2195 of comp.sys.handhelds:
Path: en.ecn.purdue.edu!noose.ecn.purdue.edu!mentor.cc.purdue.edu!purdue!bu.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!cs.utexas.edu!uunet!mnemosyne.cs.du.edu!isis!ebergman
From: ebergman@isis.cs.du.edu (Eric Bergman-Terrell)
Newsgroups: comp.sys.handhelds
Subject: Computing Great Circle Distance
Message-ID: <1990Nov6.042632.16945@isis.cs.du.edu>
Date: 6 Nov 90 04:26:32 GMT
Reply-To: ebergman@isis.UUCP (Eric Bergman-Terrell)
Organization: Math/CS, University of Denver
Lines: 78
DIST for the HP 48SX:
Introduction:
This program calculates the great circle distance in statute miles
between two cities, given their latitude and longitude in degrees,
minutes, and seconds format.
Caveats:
No correction is made for the Earth's equatorial bulge. USE THIS
SOFTWARE AT YOUR OWN RISK.
Method:
EXPRESS LATITUDES NORTH OF THE EQUATOR AS POSITIVE NUMBERS, AND
LATITUDES SOUTH OF THE EQUATOR AS NEGATIVE NUMBERS. EXPRESS
LONGITUDES WEST OF GREENWICH AS POSITIVE NUMBERS, AND LONGITUDES
EAST OF GREENWICH AS NEGATIVE NUMBERS.
Convert the two latitudes and longitudes into spherical coordinate
unit vectors. The smallest angle between the vectors is calculated
by taking the inverse cosine of the vectors' dot product.
Multiplying this angle by 60 yields the nautical miles between the
two cities. Multiplying by 6080 and then dividing by 5280 yields
statute miles.
Setup:
YOUR CALCULATOR MUST BE IN DEGREES MODE TO RUN THE PROGRAM. To get
into degrees mode, use the DEG command.
Example:
Tokyo: 35d35'00" N 139d45'00" E
Denver: 39d44'58" N 104d59'22" W
Entering the following:
35.35
-139.45
39.4422
104.5922
DIST
leaves 5800 on the stack. My almanac says that Denver is 5795
statute miles from Tokyo.
Program:
%%HP: T(3)A(R)F(.);
\<< 0 0 \-> LATA LONA
LATB LONB A B
\<< -15 SF -16 SF 1
LONA HMS\-> 90 LATA
HMS\-> - \->V3 'A' STO
1 LONB HMS\-> 90 LATB
HMS\-> - \->V3 'B' STO
A B DOT ACOS 60 *
6080 * 5280 / -15
CF -16 CF
\>>
\>>
Size/Checksum:
275 bytes
# 11808d checksum
Eric Bergman-Terrell